<?php
namespace app\admin\controller;

use app\common\controller\Back;

class Upload extends Back
{
    protected function initialize()
    {
        parent::initialize();
    }
    
    public function index()
    {
        $form = xfFormCreate([
            'name'         => 'adminUploadIndex',
            'action'       => xfUrl('admin/upload/update'),
            'items'        => model('admin/Upload','form')->items(config('upload.')),
            'reset'        => '重置',
            'class'        => 'w-100',
            'class_button' => 'text-left',
        ]);

        $this->assign('form',$form);

        $this->assign($this->site);

        return $this->fetch();
    }

    //更新配置
    public function update()
    {
        $post = xfArrayFilter(input('post.'), model('admin/Upload','form')->keys());

        $this->configSave('./config/upload.php', $post, 'admin/upload/index');
    }
}